package com.mxpio.erp.common.equipment.service;

import com.mxpio.erp.common.equipment.entity.EquipmentCheckTask;
import com.mxpio.erp.common.equipment.entity.EquipmentCheckTaskDetail;
import com.mxpio.erp.common.equipment.entity.EquipmentCheckTaskTransfer;
import com.mxpio.erp.common.equipment.vo.EquipmentCheckTaskPage;
import com.mxpioframework.common.exception.MBootException;
import com.mxpioframework.jpa.query.Criteria;
import com.mxpioframework.system.service.BaseService;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * @Description: 点检任务
 * @Author: jeecg-boot
 * @Date:   2021-09-23
 * @Version: V1.0
 */
public interface EquipmentCheckTaskService extends BaseService<EquipmentCheckTask> {

	/**
	 * 查询
	 * @param equipmentCheckTask
	 * @param flag
	 * @param planStart
	 * @param planEnd
	 * @param pageNo
	 * @param pageSize
	 * @param criteria
	 * @return
	 */
	public Page<EquipmentCheckTask> getEquipmentCheckTaskIPage(EquipmentCheckTask equipmentCheckTask, @RequestParam(name = "flag", required = true) String flag, @RequestParam(name = "planStart", required = false) String planStart, @RequestParam(name = "planEnd", required = false) String planEnd, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, Criteria criteria);
	/**
	 * 添加一对多
	 *
	 */
	public void saveMain(EquipmentCheckTask equipmentCheckTask, List<EquipmentCheckTaskDetail> equipmentCheckTaskDetailList, List<EquipmentCheckTaskTransfer> equipmentCheckTaskTransferList) throws MBootException;

	/**
	 * 修改一对多
	 *
	 */
	public void updateMain(EquipmentCheckTask equipmentCheckTask, List<EquipmentCheckTaskDetail> equipmentCheckTaskDetailList, List<EquipmentCheckTaskTransfer> equipmentCheckTaskTransferList) throws MBootException;

	/**
	 * 删除一对多
	 */
	public void delMain(String id);

	/**
	 * 批量删除一对多
	 */
	public void delBatchMain(Collection<? extends Serializable> idList);

    /**
     * 下达任务
     * @param id 执行人
     */
    void release(String id)throws MBootException ;

    /**
     * 派工
     * @param id 工单id
     * @param executor 执行人
     */
    void dispatch(String id, String executor) throws MBootException;

    /**
     * 抢单
     * @param id 工单id
     * @throws MBootException
     */
    void grab(String id)throws MBootException;

    /**
     * 执行任务
     * @param equipmentCheckTaskPage
     */
    void excut(EquipmentCheckTaskPage equipmentCheckTaskPage, HttpServletRequest request)throws MBootException;

    /**
     * 开始执行
     * @param id
     */
    void startExcut(String id)throws MBootException;

    /**
     * 转单
     * @param id 工单id
     * @param executor 新执行人
     * @param reason 原因
     */
    void reSend(String id, String executor, String reason)throws MBootException;
}
